<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>第一节课</title>
		<style type="text/css">
			/*去除原来样式*/
			
			* {
				padding: 0;
				margin: 0;
			}
			
			.container {
				width: 100vw;
				height: 100vh;
				display: flex;
				/*
				 * 将边框设置在中间
				 */
				align-items: center;
				justify-content: center;
			}
			
			canvas {
				width: 500px;
				height: 500px;
				border: 1px solid #333333;
			}
		</style>
	</head>

	<body>
		<div class="container">
			<canvas id="canvas" width="600" height="600"></canvas>
		</div>
	</body>

	<script>
		
		//window.onload = function() {
			
		/*let m = 8;
		let str = "";
			for(var i=0;i<m;i++){
				for(var j=0;j<=i;j++){
					//console.log("*");
					str+="*";
				}
				str+="\n";
			}*/
			
			let m=5;
			let str="";
			for(var i=1;i<=m;i++){
				
				for(var j=0;j<=m-i;j++){
					str+=" ";
					
				}
				
				
				for(var j=0;j<i*2-1;j++){
					//str+=" ";
					str+="*";
				}
				
				str+="\n";
			}
			
//}
		console.log(str);
		//console.log("*");
	</script>

</html>